package cre.sample.test.equals;

/**
 * 实现了Object.equals()，没有实现Object.hashCode()
 * <p/>
 * Created by CreGu on 2016/6/12.
 */
public class Person {
    private String name;
    private int age;

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (!(obj instanceof Person)) {
            return false;
        }
        Person p = (Person) obj;
        return p.name.equals(name) && p.age == age;
    }
}
